﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml.Linq;
using Microsoft.VisualStudio.Tools.Applications.Runtime;
using Excel = Microsoft.Office.Interop.Excel;
using Office = Microsoft.Office.Core;
using SharePointListSync.Actions;
using SharePointListSync.Actions.Controls;
namespace SharePointListSync
{
    public partial class ThisWorkbook
    {

        #region Declare Action Controls
        public ACHeader mACHeader;
        public ACBody mACBody;
        public ACFooter mACFooter;



      
        
        #endregion

        #region Schema Declaration 
        public String SharePointNamespacePrefix = "sp";
        public String SharePointNamespaceUri = "http://schemas.microsoft.com/sharepoint/soap/";
        public String ListItemsNamespacePrefix = "z";
        public String ListItemsNamespaceUri = "#RowsetSchema";  
        #endregion


       public SharePointListDetails DSlists = new SharePointListDetails();
       public ErrorCode ResulterrorCode; 

        private void ThisWorkbook_Startup(object sender, System.EventArgs e)
        {
            SetupPannel();
        }

        private void SetupPannel()
        {
            Microsoft.Office.Core.CommandBar ExcelCommandBar = Application.CommandBars["Task Pane"];
            ExcelCommandBar.Width = 290;
            //ExcelCommandBar.Height = 475;

            ExcelCommandBar.Position = Office.MsoBarPosition.msoBarLeft;

            Globals.Sheet1.Select();

            mACHeader = new ACHeader();
            this.ActionsPane.Controls.Add(mACHeader);
            mACHeader.Dock = DockStyle.Top;

            mACBody = new ACBody();
            this.ActionsPane.Controls.Add(mACBody);
            mACBody.Dock = DockStyle.Fill;
            
            mACFooter = new ACFooter();
            this.ActionsPane.Controls.Add(mACFooter);
            mACFooter.Dock = DockStyle.Bottom;

        }


        public void hlp_setView(ACControls controlName)
        {
            switch (controlName)
            {
                case ACControls.ACconnMgr:
                        Globals.ThisWorkbook.mACBody.mACListSync.Visible = false;
                        Globals.ThisWorkbook.mACBody.mACListSelector.Visible = false;
                        Globals.ThisWorkbook.mACBody.mACconnMgr.Visible = true;
                        break;

                case ACControls.ACListSelectors:
                        Globals.ThisWorkbook.mACBody.mACListSync.Visible = false;
                        Globals.ThisWorkbook.mACBody.mACListSelector.Visible = true;
                        Globals.ThisWorkbook.mACBody.mACconnMgr.Visible = false;
                        break;
                    
                case ACControls.ACListSync:

                        Globals.ThisWorkbook.mACBody.mACListSync.Visible = true;
                        Globals.ThisWorkbook.mACBody.mACListSelector.Visible = false;
                        Globals.ThisWorkbook.mACBody.mACconnMgr.Visible = false;
                        break;
                    
                default:
                    break;
            }
        }




        private void ThisWorkbook_Shutdown(object sender, System.EventArgs e)
        {
        }

        #region VSTO Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InternalStartup()
        {
            this.Startup += new System.EventHandler(ThisWorkbook_Startup);
            this.Shutdown += new System.EventHandler(ThisWorkbook_Shutdown);
        }

        #endregion

    }
}

